import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:live_plugin/screens/room/model/room_member.dart';

class MemberItemWidget extends StatefulWidget {
  final RoomMember? member;

  const MemberItemWidget({Key? key,this.member}) : super(key: key);

  @override
  _MemberItemWidgetState createState() => _MemberItemWidgetState();
}

class _MemberItemWidgetState extends State<MemberItemWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Row(
            children: [
              header,
              Expanded(child: Text(
                "皮卡丘",
                style: TextStyle(
                    fontSize: 15,
                    color: Color(0xFF333333)
                ),
              )),
              Padding(
                padding: EdgeInsets.only(right: 10),
                child: Icon(
                  widget.member!.quite ? Icons.mic_off_sharp : Icons.mic,
                  size: 25,
                  color: Color(0xFF979797),
                ),
              )
            ],
          ),
          Divider(
            height: 0,
            thickness: 1,
            color: Color(0xFFF6F6F6),
            indent: 45,
            endIndent: 10,
          )
        ],
      ),
    );
  }
  
  Widget get header {
    String _headerUrl = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F201502%2F24%2F20150224152644_y3MNN.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642493849&t=e1aac7e75286bf16a6c8a18a16f63836";
    return Padding(
      padding: EdgeInsets.all(10),
      child: CircleAvatar(
        radius: 15,
        backgroundImage: NetworkImage(_headerUrl),
        // child: Image.network(
        //   "$_headerUrl",
        //   width: 30,
        //   height: 30,
        //   fit: BoxFit.fill,
        // ),
      ),
    );
  }
}
